<template>


 <div>
    <el-form
            label-position="right"
            label-width="100px"
            :model="score"
            style="max-width: 460px">

            <el-form-item label-width="330px" label="宿舍安全问题检查"/>

            <el-form-item label="党员、积极分子先锋模范作用发挥好（5分）" label-width="330px">
                        <el-select v-model="score.score1"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="张贴优秀传统文化、革命文化和社会主义先进文化宣传制品（5分" label-width="330px">
                        <el-select v-model="score.score2"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>


            <el-form-item label="无私拉乱接电线（5分）" label-width="330px">
                        <el-select v-model="score.score3"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="无违章电器（5分）" label-width="330px">
                        <el-select v-model="score.score4"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="无蜡烛、酒精灯等明火设备（5分）" label-width="330px">
                        <el-select v-model="score.score5"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="无有毒、有害、易燃、易爆等危险品（5分）" label-width="330px">
                        <el-select v-model="score.score6"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="无管制刀具、各类仿真枪具等危险器具（5分）" label-width="330px">
                        <el-select v-model="score.score7"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="宿舍门窗无悬挂或张贴遮盖物，床铺无帷幔（5分）" label-width="330px">
                        <el-select v-model="score.score8"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>


            <el-form-item label="无电竞椅、台式电脑及影响人员流通的大件家具" label-width="330px">
                        <el-select v-model="score.score9"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="室内空气清新，无异味（5分）" label-width="330px">
                        <el-select v-model="score.score10"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="室内物品摆放整齐、有序（5分）" label-width="330px">
                        <el-select v-model="score.score11"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="地面整洁，无垃圾（5）" label-width="330px">
                        <el-select v-model="score.score12"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="学生宿舍卫生值日制度并张贴于显著位置（5）" label-width="330px">
                        <el-select v-model="score.score13"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="学习、研讨及相关活动（5分）" label-width="330px">
                        <el-select v-model="score.score14"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="教学时间不卧床休息（5分）" label-width="330px">
                        <el-select v-model="score.score15"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="教学时间不打游戏（5分）" label-width="330px">
                        <el-select v-model="score.score16"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="无旷课现象（5分）" label-width="330px">
                        <el-select v-model="score.score17"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="讲文明礼貌（5分）" label-width="330px">
                        <el-select v-model="score.score18"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>

            <el-form-item label="积极配合检查（5分）" label-width="330px">
                        <el-select v-model="score.score19"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>


            <el-form-item label="精神状态健康、向上（5分）" label-width="330px">
                        <el-select v-model="score.score20"
                        placeholder="请选择"
                        style="width: 240px"
                        >
                        <el-option label="1" value="1"/>
                        <el-option label="2" value="2"/>
                        <el-option label="3" value="3"/>
                        <el-option label="4" value="4"/>
                        <el-option label="5" value="5"/>
                        <el-option label="0" value="0"/>
                        </el-select>
            </el-form-item>



            <el-form-item  label-width="330px">
                <el-button @click="upload()">打分</el-button>
            </el-form-item>

    </el-form>
 </div>


</template>
<script>
import htmlToPdf from '@/script/htmlToPdf'
export default {

  data () {
    return {
      score: {},
      securities: [],
      rectification: {},
      user: {},
      role: '',
    }
  },
  created () {

    // 获得角色信息
    this.role = window.sessionStorage.getItem('role')

    // 获得用户信息
    this.user = JSON.parse(window.sessionStorage.getItem('user'))

    this.score.dormitoryId = window.sessionStorage.getItem('d_id')

    // 查看宿舍安全问题
    this.$http.get('/dormitory/seurity/' + window.sessionStorage.getItem('d_id')).then(response => {
        this.securities = response.data
    })


},
  methods: {


    // 导出Pdf
    exportPdf(id,time) {
       htmlToPdf.downloadPDF(document.querySelector("#mypdf" + id), "宿舍安全情况-" + time);
    },

    upload() {
        this.$http.post('/score', this.score).then(response => {
            this.$message({
                type: 'success',
                message: '打分成功!'
            })
        this.$router.push('/home/dormitory/user')
        })
    }
  }
}
</script>
<style>

  .my-label {
    background: #E1F3D8;
  }

  .my-content {
    background: #FDE2E2;
  }

</style>